*******************************************************************************
* Purpose: Analyses on somatic health of mother and child
*******************************************************************************
do "D:\Data\workdata\708296\Project - Mother groups and mental health\Do\global.do" 


use "$work\final_data1", clear


********************************************************************************
* Table C13: Effects of exposure to a depressed peer on child gp care and hospitalizations
********************************************************************************

eststo clear
foreach v of varlist sumhonorar0 sumhonorar1 hospage0 {
areg `v' peer_treat, absorb(time fe mfr_first) vce(cluster group)
estimates store e`v'
summarize `v' if peer_treat == 0, meanonly
estadd scalar means = r(mean)
}
areg hospage1 peer_treat if mfr_yob < 2017, absorb(time fe mfr_first) vce(cluster group)
estimates store eallhosp1
summarize hospage1 if peer_treat == 0, meanonly
estadd scalar means = r(mean)

esttab e* using "$out\gpchild.tex", fragment b(3) se(3) keep(peer_treat) stats(means N, fmt(%13.2fc %13.0fc) label("Control group mean" "Obs.")) se star(* 0.10 ** 0.05 *** 0.01) alignment(c c) label nolegend nonote replace

*******************************************************************************
* Table C14: Effects of exposure to a depressed peer on maternal gp care and hospitalizations	
*******************************************************************************
use "$work\final_data1", clear
eststo clear
foreach v of varlist sumhonorarm0 sumhonorarm1 hospagem0{
areg `v' peer_treat , absorb(time fe mfr_first) vce(cluster group)
estimates store j`v'
summarize `v' if peer_treat == 0, meanonly
estadd scalar means = r(mean)
}
areg hospagem1 peer_treat if mfr_yob < 2017, absorb(time fe mfr_first) vce(cluster group)
estimates store jhospagem1
summarize hospagem1 if peer_treat == 0, meanonly
estadd scalar means = r(mean)

esttab j* using "$out\gpmom.tex", fragment b(3) se(3) keep(peer_treat) stats(means N, fmt(%13.2fc %13.0fc) label("Control group mean" "Obs.")) se star(* 0.10 ** 0.05 *** 0.01) alignment(c c) label nolegend nonote replace
	